<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>无标题文档</title>
	<link href="/static/css/default.css" rel="stylesheet" type="text/css">
	<link href="/static/css/style/green.css" rel="stylesheet" type="text/css" id=link'>

</head>

<body style="overflow:hidden; padding:10px;">
	<form>
		<table class="formtable" style="width:580px;">

			<tbody>

				<tr>

					<td class="tlabel">机构名称</td>
					<td>
							{$info.name}
					</td>

				</tr>
				<tr>
					<td class="tlabel">联系人</td>
					<td>
							{$info.truename}
					</td>

				</tr>
				<tr>

					<td class="tlabel">联系电话</td>
					<td>
							{$info.phone}
					</td>

				</tr>
				<tr>
					<td class="tlabel">地区</td>
					<td>
							{$info.province}-{$info.city}-{$info.area}
					</td>

				</tr>
				<tr>
					<td class="tlabel">简介</td>
					<td>
							{$info.desc}
					</td>

				</tr>
				<tr>

					<td class="tlabel">开通方式</td>
					<td>
						<select type="text" id="opentype" class="select" v-model="checked" @change="change">
							<option value="">
								请选择
							</option>
							<option v-for="item in list" :value='item.value'>
								{{item.value}}
							</option>
						</select>


						<select type="text" id="daili" class="select" v-model="checked" style="<?php if($info['dailiid']!=0){ echo 'display:initial';}else{ echo 'display:none';} ?>">
							<option value="0">请选择</option>
							<option v-for="item in list" :value='item.id'>
								{{item.name}}
							</option>
						</select>
					</td>

				</tr>

				<tr>
					<td class="tlabel">机构类型</td>
					<td>
						<select type="text" id="mtype" class="select" v-model="checked">
							<option value="">
								请选择
							</option>
							<option v-for="item in list" :value='item.value'>
								{{item.value}}
							</option>
						</select>


					</td>
				</tr>
				<tr>
					<td class="tlabel">到期时间</td>
					<td>
						<select type="text" id="month" class="select">
							<option value="1">1个月</option>
							<option value="2">2个月</option>
							<option value="3">3个月</option>
							<option value="4">4个月</option>
							<option value="5">5个月</option>
							<option value="6">6个月</option>
							<option value="7">7个月</option>
							<option value="8">8个月</option>
							<option value="9">9个月</option>
							<option value="10">10个月</option>
							<option value="11">11个月</option>
							<option value="12">12个月</option>
						</select>
					</td>
				</tr>
				







			</tbody>

		</table>

		<div class="formbtn">
			<input type="button" value="保存" class="btnsave">
			<input type="button" value="取消" class="btncancel">
		</div>
		<input type="hidden" id="id" value="{$info.id}" />
	</form>


</body>
<script type="text/javascript" src="/static/js/jquery.js"></script>
<script type="text/javascript" src="/static/js/common.js"></script>
<script type="text/javascript" src="/static/js/vue2.js"></script>
<script src="/static/js/layer/layer.js"></script>
<link rel="stylesheet" href="/static/kindeditor/themes/default/default.css" />
<script charset="utf-8" src="/static/kindeditor/kindeditor-min.js"></script>
<script charset="utf-8" src="/static/js/city.data-3.js"></script>
<script charset="utf-8" src="/static/My97DatePicker/WdatePicker.js"></script>

<script>

var mtype = "{$info.mtype}";
	var opentype = "{$info.opentype}";
	var vue = new Vue({
		el: '#mtype',
		data: {
			checked: mtype,
			list: [],
		},
		methods: {

			getdata: function () {
				var _self = this;//保存this的指向
				$.post('/super/Index/getdiclist', { "name": "机构类型" }, function (data) {
					console.log(data);
					_self.list = data;
				});
			}

		},
		created: function () {  //初始化事件里边去调用查询方法
			this.getdata();
		}
	});
	var vue = new Vue({
		el: '#daili',
		data: {
			checked: "{$info.dailiid}",
			list: [],
		},
		methods: {

			getdata: function () {
				var _self = this;//保存this的指向
				$.post('/super/mechanism/GetDailiList', {  }, function (data) {
					console.log(data);
					_self.list = data;
				});
			}

		},
		created: function () {  //初始化事件里边去调用查询方法
			this.getdata();
		}
	});
	var vue = new Vue({
		el: '#opentype',
		data: {
			checked: opentype,
			list: []
		},
		methods: {
			//
			change: function () {
				if(this.checked=="代理商代理客户"){
					$("#daili").show();
				}else{
					$("#daili").hide();
					$("#daili").val(0);
				}
				
			},
			getdata: function () {
				var _self = this;//保存this的指向
				$.post('/super/Index/getdiclist', { "name": "开通方式" }, function (data) {
					console.log(data);
					_self.list = data;
				});
			}

		},
		created: function () {  //初始化事件里边去调用查询方法


			this.getdata();
		}
	});
	$(function () {
		$(".btnsave").click(function () {

			var id = $("#id").val();

			var opentype = $("#opentype").val();
			var dailiid = $("#daili").val();
			var mtype = $("#mtype").val();
			var month = $("#month").val();
			


			$.post("/super/Mechanism/sh", {
				"id": id, "opentype": opentype, "dailiid": dailiid, "mtype": mtype,
				"month": month
			}, function (data) {
				if (data.status == 200) {
					parent.layer.msg(data.message);

					var index = parent.layer.getFrameIndex(window.name);
					window.parent.iframe.contentWindow.location.reload(true);
					console.log(window.parent.iframe);
					parent.layer.close(index);
				} else {
					layer.msg(data.message);
				}
			});
		});
		$(".btncancel").click(function () {
			var index = parent.layer.getFrameIndex(window.name);
			parent.layer.close(index);
		});
	});


</script>

</html>